<template>
	<view class="form">
		<view class="cu-form-group">
			<view class="title">项目</view>
			<view>{{ reportData.dataItemName }}</view>
		</view>
		<view class="cu-form-group">
			<view class="title">日期</view>
			<view>{{ reportData.createTime }}</view>
		</view>
		<view class="cu-form-group">
			<view class="title">数据类别</view>
			<view v-if="reportData.dataItemType == 'text'">文本</view>
			<view v-if="reportData.dataItemType == 'number'">数值</view>
			<view v-if="reportData.dataItemType == 'pic'">图片</view>
			<view v-if="reportData.dataItemType == 'word'">文档</view>
			<view v-if="reportData.dataItemType == 'fwb'">富文本</view>
			<view v-if="reportData.dataItemType == 'link'">链接</view>
			<view v-if="reportData.dataItemType == 'video'">视频</view>
		</view>
		
		<view class="cu-form-group">
			<view class="title">上报数据说明</view>
		</view>
		<view class="cu-form-group" style="padding-top: 0; border: none;">
			<textarea style="margin-top: 0; height: 180rpx;" v-model="reportData.dataItemValue"></textarea>
		</view>
		<!-- <view class="cu-form-group align-start">
			<view class="title">备注</view>
			<textarea maxlength="-1" placeholder="请输入备注信息"></textarea>
		</view> -->
		<view class="file-group">
			<view class="title">附件</view>
			<view class="file-list">
				<!-- <view class="li">文件123123123123</view>
				<view class="li">文件123123123123</view>
				<view class="li">文件123123123123</view>
				<view class="li">文件123123123123</view> -->
			</view>
		</view>
		<view class="cu-form-group" @tap="getLocation()">
			<view class="title">地址</view>
			<text class='cuIcon-location text-blue icon'></text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				reportId: '',
				reportData: {},
			}
		},
		methods: {
			onLoad: function (option) {
			    const id = option.id;
				this.reportId = id;
				this.getData();
			},
			getData() {
				let id = this.reportId;
				let token = getApp().globalData.token;
				uni.request({
					url: getApp().globalData.url + '/blade-visual/dataitem/detail',
					header: { 'blade-auth': "bearer " + token },
					method: "get",
					data: {
						id: id,
					},
					success: (res) => {
						// console.log(res);
						let code = res.data.code;
						if(code == 200) {
							let data = res.data.data;
							this.reportData = data;
						} else {
							uni.showToast({
								title: res.data.msg,
								duration: 2000,
								icon: 'none'
							})
						}
					}
				});
			},
		}
	}
</script>

<style>
	.file-group {
		min-height: 106rpx;
	    background-color: #ffffff;
	    padding: 20rpx 32rpx;
		border-top: 2rpx solid #eee;
		border-bottom: 2rpx solid #eee;
	}
	
	.file-group .title {
		line-height: 64rpx;
	    font-size: 32rpx;
	}
	
	.file-group .li {
		line-height: 54rpx;
	}
</style>
